/**********************************************************************

Filename    :   FxGameDelegate.cpp
Content     :   External Interface callback registration mechanism
Created     :
Authors     :   Prasad Silva

Copyright   :   (c) 2005-2009 Scaleform Corp. All Rights Reserved.

This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR ANY PURPOSE.

**********************************************************************/

#include "FxGameDelegate.h"

//
// Visitor to register callbacks
//
// class AddCallbackVisitor : public CallbackProcessor
// {
// public:
//     AddCallbackVisitor(FxDelegateHandler* pthis, CallbackHash* phash)
//         : pThis(pthis), pHash(phash) {}
// 
//     void Process(const GString& methodName, CallbackFn method)
//     {
//         CallbackDefn cbt;
//         cbt.pThis = pThis;
//         cbt.pCallback = method;
//         pHash->Add(methodName, cbt);
//     }
// 
// private:
//     FxDelegateHandler*          pThis;
//     CallbackHash*   pHash;
// };
// 
// 
// //
// // Visitor to unregister callbacks
// //
// class RemoveCallbackVisitor : public CallbackProcessor
// {
// public:
//     RemoveCallbackVisitor(FxDelegateHandler* pthis, CallbackHash* phash)
//         : pThis(pthis), pHash(phash) {}
// 
//     void Process(const GString& methodName, CallbackFn method)
//     {
//         GUNUSED(method);
//         pHash->Remove(methodName);
//     }
// 
// private:
//     FxDelegateHandler*          pThis;
//     CallbackHash*   pHash;
// };

////////////////////////////////////////////////////////////////////////////
//
//
//void FxDelegate::RegisterHandler(FxDelegateHandler* callback)
//{
//    AddCallbackVisitor reg(callback, &m_Callbacks);
//    callback->Accept(&reg);
//}
//
//void FxDelegate::UnregisterHandler(FxDelegateHandler* callback)
//{
//    RemoveCallbackVisitor reg(callback, &m_Callbacks);
//    callback->Accept(&reg);
//}
//
//void FxDelegate::Callback(GFxMovieView* pmovieView, const char* methodName, const GFxValue* args, UInt argCount)
//{
//    CallbackDefn* pcb = m_Callbacks.GetAlt(methodName);
//    if (pcb != NULL) 
//    {
//        FxDelegateArgs params(pcb->pThis, 
//                              pmovieView, 
//                              &args[0], 
//                              argCount);
//        pcb->pCallback(params);
//    }
//    else if (m_Fallback.pThis.GetPtr() != NULL)
//    {
//        FxDelegateArgs params(m_Fallback.pThis, 
//                              pmovieView, 
//                              &args[0], 
//                              argCount);
//        m_Fallback.pCallback(params, methodName);
//    }
//}
